<app-content-header
  [search]="search"
  [showSearch]="ifShowSearch"
  (actionClick)="handleAction()"
  (searchClick)="handleSearch()"
>
  <!--
    [action]="action"
    <ng-template #action>
      <i nz-icon type="plus"></i>{{ 'BTN.ADD' | translate }}
    </ng-template>
  -->
  <ng-template #search>
    <app-search [(data)]="searchSchema" [customItems]="customSchema" (bindSearch)="handleSearch()"></app-search>
  </ng-template>
</app-content-header>

<ng-template #tplAcquirer>
  <app-aams-select
    level="institution"
    [(ngModel)]="selectedAcquirer"
    [disabled]="isAcquirerUser"
    (valueChange)="aamsChangeHandler($event)"
  ></app-aams-select>
</ng-template>

<ng-template #tplGroup>
  <app-aams-select
    level="agent"
    [(ngModel)]="selectedGroup"
    [insCode]="selectedAcquirer ? selectedAcquirer.code : ''"
    [disabled]="isAgentUser"
    (valueChange)="aamsChangeHandler($event)"
  ></app-aams-select>
</ng-template>

<ng-template #tplMerchant>
  <app-aams-select
    level="merchant"
    [(ngModel)]="selectedMerchant"
    [insCode]="selectedAcquirer ? selectedAcquirer.code : ''"
    [agentCode]="selectedGroup ? selectedGroup.code : ''"
    [disabled]="isMerchantUser"
    (valueChange)="aamsChangeHandler($event)"
  ></app-aams-select>
</ng-template>

<ng-template #tplStore>
  <app-aams-select
    level="store"
    [(ngModel)]="selectedStore"
    [insCode]="selectedAcquirer ? selectedAcquirer.code : ''"
    [agentCode]="selectedGroup ? selectedGroup.code : ''"
    [intMerCode]="selectedMerchant ? selectedMerchant.code : ''"
    [disabled]="isStoreUser"
    (valueChange)="aamsChangeHandler($event)"
  ></app-aams-select>
</ng-template>

<ng-template #tplStatus>
  <nz-select style="width: 100%;" [(ngModel)]="userStatus" nzAllowClear>
    <nz-option *ngFor="let status of updateStatus"
      [nzValue]="status.value"
      [nzLabel]="status.label">
    </nz-option>
  </nz-select>
</ng-template>

<ng-template #tplUserType>
  <nz-select style="width: 100%;" [(ngModel)]="userType" nzAllowClear>
    <nz-option *ngFor="let userType of userTypes"
      [nzValue]="userType.value"
      [nzLabel]="userType.label"
    ></nz-option>
  </nz-select>
</ng-template>

<div class="cil-table-block">
  <st
    #st
    [scroll]="scroll"
    [data]="data"
    [columns]="columns"
    [widthMode]="widthMode"
    [ps]="ps"
    [pi]="pi"
    [page]="stPage"
    [total]="total"
    [loading]="loading"
    (change)="onChange($event)"
  >
  <ng-template st-row="userTypeParentID" let-item let-index="index">
    <span>{{ getUserLevelID(item) }}</span>
  </ng-template>
  <ng-template st-row="userType" let-item>
    <span>{{ getUserType(item.userType) }}</span>
  </ng-template>
  <ng-template st-row="status" let-item>
    <span>{{ getUserStatus(item.status) }}</span>
  </ng-template>
</st>
  <!-- 一期不上
  <div *ngIf="!loading" #btns class="cil-custom-btns">
    <button
      class="cil__custom-btn__whiteblue"
      nz-button
      nzType="primary"
      nzShape="round"
      nzSize="default"
    >
      自定义展示列
    </button>
    <button
      class="cil__custom-btn__lightblue"
      nz-button
      nzType="primary"
      nzShape="round"
      nzSize="default"
    >
      <i nz-icon type="download"></i>
      {{'BTN.EXPORT' | i18n}}
    </button>
  </div>
  -->
</div>

